<?php
require("lib/functions.php");
include("config/myst.php");
include("config/servers.php");
include("config/access.php");
$level = GetLevel();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?php echo "{$myst['CPName']} :: {$title}"; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="templates/default/style.css" rel="stylesheet" type="text/css" /></head>
</head>
<body>
<div id="wrap">
  <div id="header">
    <h1 id="logo-text"><?php echo $myst['CPName']; ?></h1>
    <!--- you can put a slogan here if you want... <h2 id="slogan">put your site slogan here...</h2> --->
	<div id="status">
		<?php 
		if ( !$_POST['s_id'] )
			$_POST['s_id'] = 1;
		$s_status = ServerStatus($_POST['s_id']); ?>
		<h3>Server status</h3>
		<p>Login: <?php echo $s_status['l']; ?> </p>
		<p>Char: <?php echo $s_status['c']; ?> </p>
		<p>Map: <?php echo $s_status['m']; ?> </p>
		<p>Online: <?php echo $s_status['o']; ?> players</p>
		<?php
		if (count($servers) > 1)
		{
		?>
			<center><form action=# method='post'>
				<select name='s_id'>
				<?php foreach ($servers as $k => $v)
				{
						echo "<option value=$servers[$k]>{$v['ServerName']}";
				} ?>
			</select>
			</form>
		<?php
		}
		?>
		</center>
	</div>
  </div>
  </div>
  <div id="content" class="clearfix">
	<div id="nav">
		<?php
			echo "<h1>".key($myst['MenuItems'])."</h1>";
			echo "<ul><li>";
			foreach ( $myst['MenuItems'] as $k => $v )
			{
				foreach ( $myst['MenuItems'][$k] as $k2 => $v2 )
				{
					if ( $access['user'][$k][$k2] <= $level || $access['user'][$k][$k2] == -2 )
					{
						if ( $v2['module'] != 'exturl' )
						{
							echo "<li><a href='?module={$v2['module']}&action={$v2['action']}'>$k2</a></li>";
						}
						else 
						{
							echo "<li><a href='{$v2['action']}'>$k2</a></li>";
						}
					}
					//elseif ( $access['user'][$k][$k2] == -2 )
					//{
					//	echo "<li><a href='?module={$v2['module']}&action={$v2['action']}'>$k2</a></li>";
					//}
					else
					{
					}
				}
			echo "<br /><h2>".key($myst['MenuItems'])."</h2><br />";
			next($myst['MenuItems']);
			}
		?>
    </div>
